package org.gw.building.repositories;

import org.gw.building.model.Yx;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * @author qianwx
 */
public interface YxRepository extends CrudRepository<Yx, String> {
    @Query("from Yx t where (?1 is null or t.mc like ?1) and (?2 is null or t.sfyx = ?2) order by px asc")
    Page<Yx> listYx(String s, String sfyx, Pageable pageable);

    @Query("select max(px) from Yx")
    Integer maxPx();

    List<Yx> findBySfyx(boolean b);
}
